/* new 具体干了什么
1. 创建对象object
2. 链接到构造函数原型
3. 绑定this
4. 返回创建对象 */
function New(f){
    return function(){
        var obj = {"__proto__": f.prototype}
        let res = f.apply(obj, arguments)
        return typeof res ==="object"?res:obj
    }
}
function Person(name, age){
    this.name = name
    this.age = age

}
var people = New(Person)("lili", 13)
console.log(people.name, people.age)
console.log(people instanceof Person)